package com.zhkj.txg.module.order.popup

import android.content.Context
import android.view.Gravity
import android.view.View
import com.zhkj.txg.R
import razerdp.basepopup.BasePopupWindow

class OrderReceivePopupWindow(
    context: Context,
    val onConfirm: (uiPosition: Int, orderId: Long) -> Unit
) : BasePopupWindow(context) {

    private var orderId: Long = 0
    private var uiPosition: Int = 0

    init {
        popupGravity = Gravity.CENTER
        setOutSideDismiss(false)
    }

    override fun onCreateContentView(): View = createPopupById(R.layout.popup_receive_confirm)

    override fun onViewCreated(contentView: View?) {
        contentView?.findViewById<View>(R.id.tvUserNicknameCancel)?.setOnClickListener {
            dismiss()
        }
        contentView?.findViewById<View>(R.id.tvUserNicknameConfirm)?.setOnClickListener {
            dismiss()
            onConfirm(uiPosition, orderId)
        }
    }

    fun setData(uiPosition: Int, orderId: Long) {
        this.uiPosition = uiPosition
        this.orderId = orderId
    }
}